package com.jt.demo2;

import com.jt.demo1.proxy.JDKProxy;
import com.jt.demo2.config.SpringConfig;
import com.jt.demo2.proxy.SpringProxy;
import com.jt.demo2.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.lang.annotation.Target;

public class SpringTx {
    public static void main(String[] args) {
        ApplicationContext context=
                new AnnotationConfigApplicationContext(SpringConfig.class);
        UserService userService = context.getBean(UserService.class);
        userService.userAdd();
        UserService proxy = (UserService) SpringProxy.getProxy(userService);
        System.out.println(proxy.getClass());
    }
}
